Suspect Links

Hi there,

I'm trying to make a script the will count all the suspect links (incoming) in a module. This is what I have of now but it doesn't seem to do the trick.
 

int datLnkSus 
int datObjMod 
Date dLnkSus 
Date dObj
int nSusLinks = 0
Object o, src
Module m = current
Link lnk
 
for o in m do
{
 
for lnk in o -> "*" do
{
src = source (lnk)
dLnkSus = dateOnly lnk."Suspicion Cleared Forwards"""
dObj = src."Last Modified On"""
datLnkSus = intOf(dLnkSus)
datObjMod = intOf(dObj)
if(dLnkSus != dObj)
nSusLinks++
}
}
print "\nSuspect Links : "nSusLinks""

 


I was also thinking of a way to use a filter and just count all the objects but I don't know how to turn that filter on. There has to be some way though, it's so easy to do in the GUI.

 


tommy3824 - Fri Jan 16 08:45:52 EST 2009

Re: Suspect Links
Tony_Goodman - Fri Jan 16 10:38:16 EST 2009

Couple of points:
1. Using the "Last Modified On" attribute is only accurate to the day.
2. You are comparing the dates for equality, not one greater than the other.

Here is an example. You will need to add your own checks for null objects etc...
 

Module m = current Module
 
Object o = null
Link l = null
Object t = null
int count = 0
 
for o in m do
{
for l in o -> "*" do
{
t = target(l)
if (lastModifiedTime(t) > lastModifiedTime(o)) count++
}
}
print count ""

Re: Suspect Links
Tony_Goodman - Fri Jan 16 10:39:24 EST 2009

Tony_Goodman - Fri Jan 16 10:38:16 EST 2009

Couple of points:
1. Using the "Last Modified On" attribute is only accurate to the day.
2. You are comparing the dates for equality, not one greater than the other.

Here is an example. You will need to add your own checks for null objects etc...
 

Module m = current Module
 
Object o = null
Link l = null
Object t = null
int count = 0
 
for o in m do
{
for l in o -> "*" do
{
t = target(l)
if (lastModifiedTime(t) > lastModifiedTime(o)) count++
}
}
print count ""

The {code} markup works well!!! :-(

Re: Suspect Links
tommy3824 - Fri Jan 16 11:30:33 EST 2009

Tony_Goodman - Fri Jan 16 10:39:24 EST 2009
The {code} markup works well!!! :-(

It's an awesome code markup :)

I got it to work. Thanks a lot. Sorry the code I pasted wasn't the closest version I had. I copied the wrong one. I was actually looking for in-links. As a last ditch effort I was using the != to get some sort of result. lastModifiedTime is what really did it :) I like how thats included in the DXL help...